home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93a.txt / 000119_icon-group-sender _Mon Apr 12 15:40:46 1993.msg < prev    next >
Internet Message Format  |  1993-04-21  |  35KB

  1. Received: by cheltenham.cs.arizona.edu; Mon, 12 Apr 1993 19:58:24 MST
  2. Date: Mon, 12 Apr 93 15:40:46 PDT
  3. From: alex@laguna.Metaphor.COM (Bob Alexander)
  4. Message-Id: <9304122240.AA00662@laguna.Metaphor.COM>
  5. To: icon-group@cs.arizona.edu
  6. Subject: Re: Looking for "instant guide" for Icon
  7. Status: R
  8. Errors-To: icon-group-errors@cs.arizona.edu
  9.  
  10. >Has anyone by chance already produced an "instant guide" for
  11. >Icon?  If so, I'd much appreciate getting a copy of it.
  12.  
  13. Well, it just so happens...
  14.  
  15. This is in the Icon Program Library last time I looked, but I'll attach
  16. it to this message as well.  I created a help file that could be used
  17. as an "instant guide".  It also provides an on-line help facility --
  18. the program and data file are attached.
  19.  
  20. There also once was a nicely formatted Reference Sheet (the 8 1/2 x 11
  21. equivalent of a Reference *Card*  :-), but I don't know if it's still
  22. maintained and destributed.  The number on the copy I have tacked to my
  23. wall is IPD107, updated for version 8 but not for *.xx.  It doesn't
  24. seem to be in the version 8.7 UNIX distribution (too bad).  Maybe the
  25. Icon Project has an up-to-date copy if you need one, or I could mail
  26. you a copy of my slightly-out-of-date one (hard copy).
  27.  
  28. Hope this helps...
  29.  
  30. ------------------- ihelp.icn ---------------------
  31.  
  32. ############################################################################
  33. #
  34. #    Name:    ihelp.icn
  35. #
  36. #    Title:    On-line "help" facility.
  37. #
  38. #    Author:    Robert J. Alexander
  39. #
  40. #    Date:    December 5, 1989
  41. #
  42. ############################################################################
  43. #
  44. #  ihelp -- Program to display "help" information
  45. #
  46. #       ihelp [-f helpfile] [item] [keyword ...]
  47. #
  48. #  The optional item name specifies the section of the help file which
  49. #  is to be displayed.  If no item name is specified a default section
  50. #  will be displayed, which usually lists the help items that are
  51. #  available.  An initial substring of the item name that differentiates
  52. #  it from other items is sufficient.
  53. #
  54. #  If keyword(s) are specified, then only lines that contain all of the
  55. #  keywords, in any order, are displayed.  The keywords do not have to
  56. #  correspond to whole words in the help text; only to text fragments.
  57. #
  58. #  All item name and keyword matches are case independent.
  59. #
  60. #  The help file name is taken from environment variable "HELPFILE".  If
  61. #  HELPFILE is not in the environment, file "help" in the current
  62. #  directory is used.  A help file name specified in the -f option
  63. #  overrides.
  64. #
  65. #  The help files are formatted as follows:
  66. #
  67. #       default text lines
  68. #       -
  69. #       one
  70. #       item "one" text lines
  71. #       -
  72. #       two
  73. #       item "two" text lines
  74. #       ...
  75. #
  76. #  Sections are separated by lines containing a single "-".  Item names
  77. #  are the first line following a separator line.
  78. #
  79.  
  80.  
  81. link options
  82.  
  83.  
  84. procedure main(arg)
  85.    #
  86.    #  Initialize.
  87.    #
  88.    defaultHelpFile := "help"
  89.    opts := options(arg,"f:")
  90.    fn := \opts["f"] | "" ~== getenv("HELPFILE") | defaultHelpFile
  91.    f := open(fn) | stop("Can't open help file \"",fn,"\"")
  92.    #
  93.    #  Look for the specified section, if one was.
  94.    #
  95.    if item := map(arg[1]) then {
  96.       line := ""
  97.       until item == map(line[1:*item + 1]) do {
  98.      while read(f) ~== "-"
  99.      line := read(f) | stop("No help for ",item)
  100.      }
  101.       }
  102.    #
  103.    #  Output the section lines that contain the keywords.
  104.    #
  105.    write(line)
  106.    keywords := arg[2:0] | []
  107.    every i := 1 to *keywords do keywords[i] := map(keywords[i])
  108.    while "-" ~== (line := read(f)) do {
  109.       lline := map(line)
  110.       if not (every k := !keywords do if not find(k,lline) then break) then
  111.         write(line)
  112.       }
  113. end
  114.  
  115. ----------- help ------------------------------------------------
  116.  
  117. Icon Programming Language Version 8.7 Help Summaries
  118.  
  119.     Help summaries are available for each of the Icon executable
  120.     programs (icont, iconx), and for many aspects of the Icon
  121.     language itself.    
  122.  
  123.     To see the help summaries, enter one of the following commands:
  124.     
  125.     ihelp icont            # Icon translator & linker
  126.     ihelp iconx            # Icon interpreter
  127.  
  128.     ihelp expressions        # summary of expressions & precedence
  129.     ihelp functions        # summary of functions
  130.     ihelp operations        # summary of operations
  131.     ihelp keywords        # list of keywords
  132.     ihelp datatypes        # list of Icon datatypes
  133.     ihelp reserved        # list of reserved words
  134.     ihelp escapes        # list of string escape sequences
  135.     ihelp abbreviations        # abbreviations used in help files
  136.     ihelp <function name>    # information on specific function
  137.     ihelp about            # bibliography and credits for help file
  138.  
  139. -
  140. abs(N) : N                # compute absolute value
  141.  
  142. Produces the absolute value of N.
  143. -
  144. acos(r1) : r2                # compute arc cosine
  145.  
  146. Produces the arc cosine of r1 in the range of 0 to pi for r1 in the
  147. range of -1 to 1.
  148. -
  149. any(c,s,i1,i2) : i3            # locate initial character
  150.  
  151. Succeeds and produces i1 + 1 if s[i1] is in c and i2 > i1, but fails
  152. otherwise.
  153.  
  154. Defaults:
  155. s    &subject
  156. i1    &pos if s defaulted, otherwise 1
  157. i2    0 
  158. -
  159. args(p) : i                # get number of procedure arguments
  160.  
  161. Produces the number of arguments for procedure p.  For built-in
  162. procedures with a variable number of arguments, the value produced is
  163.  -1.  For declared procedures with a variable number of arguments, the
  164. value returned is the negative of the number of formal prameters.
  165. -
  166. bal(c1,c2,c3,s,i1,i2) : i3,i4,...,in    # locate balanced characters
  167.  
  168. Generates the sequence of integer positions in s preceding a character
  169. of c1 in s[i1:i2] that is balanced with respect to the characters of c2
  170. and c3, but fails if there is no such position.
  171.  
  172. Defaults:
  173. c1    &cset
  174. c2    '('
  175. c3    ')'
  176. s    &subject
  177. i1    &pos if s defaulted, otherwise 1
  178. i2    0 
  179. -
  180. callout(x,x1,x2,...,xn) : xm        # call external function
  181.  
  182. Calls the external function specified by x with arguments x1, x2, ...,
  183. xn.  The mechanism for locating the function specified by x is system
  184. dependent.
  185. -
  186. center(s1,i,s2) : s3            # position string at center
  187.  
  188. Produces a string of size i in which s1 is centered, with s2 used for
  189. padding at left and right as necessary.
  190.  
  191. Defaults:
  192. i    1
  193. s2    " " (blank)
  194. -
  195. char(i) : s                # produce character
  196.  
  197. Produces a string of length 1 consisting of the character whose
  198. internal representation is i.
  199. -
  200. chdir(s) : n                # change directory
  201.  
  202. Changes the directory to s but fails if there is no such directory
  203. or if the change cannot be made.
  204. -
  205. close(f) : f                # close file
  206.  
  207. Produces f after closing it unless f was opened with the pipe ("p")
  208. option, in which case the integer exit status of the command is
  209. returned.
  210. -
  211. collect(i1,i2) : n            # perform garbage collection
  212.  
  213. Causes a garbage collectionin region i1, requesting i2 bytes of space
  214. in that region.  It fails if the requested space is not available.  The
  215. regions are identified as follows:
  216.  
  217.     1    Static region
  218.     2    String region
  219.     3    Block region
  220.  
  221. If i1 is 0, a collection is done, but no region is identified and i2
  222. has no effect.  The value of i2 is ignored for the static region.
  223.  
  224. Defaults:
  225. i1    0
  226. i2    0
  227. -
  228. copy(x1) : x2                # copy value
  229.  
  230. Produces a copy of x1 if x1 is a structure; otherwise it produces x1.
  231. -
  232. cos(r1) : r2                # compute cosine
  233.  
  234. Produces the cosine of r1 in radians.
  235. -
  236. cset(x)                    # convert to cset
  237.  
  238. Produces a cset resulting from converting x, but fails if the
  239. conversion is not possible.
  240. -
  241. delay(i) : n                # delay execution
  242.  
  243. Delays execution i milliseconds.
  244. -
  245. delete(X,x) : X                # delete element
  246.  
  247. If X is a set, deletes x from X.  If X is a table, deletes the element
  248. for key x from X.  Produces X.
  249. -
  250. detab(s1,i1,i2,...,in) : s2        # remove tabs
  251.  
  252. Produces a string based on s1 in which each tab character is replaced
  253. by one or more blanks.  Tab stops are at i1, i2, ..., in, with
  254. additional stops obtained by repeating the last interval.
  255.  
  256. Default:
  257. i1    9
  258. -
  259. display(i,f) : n            # display variables
  260.  
  261. Writes the image of the current co-expression and the values of the
  262. local variables in the current procedure call.  If i > 0, the local
  263. variables in the i preceding procedure calls are displayed as well.
  264. After all local variables are displayed, the values of global variables
  265. are displayed.  Output is written to f.
  266.  
  267. Defaults:
  268. i    &level
  269. f    &errout
  270. -
  271. dtor(r1) : r2                # convert degrees to radians
  272.  
  273. Produces the radian equivalent of r1 given in degrees.
  274. -
  275. entab(s1,i1,i2,...,in) : s2        # insert tabs
  276.  
  277. Produces a string based on s1 in which runs of blanks are replaced by
  278. tabs.  Tab stops are at i1, i2, ..., in, with additional stops obtained
  279. by repeating the last interval.
  280.  
  281. Default:
  282. i1    9
  283. -
  284. errorclear() : n            # clear error indication
  285.  
  286. Clears the indications of the last error.
  287. -
  288. exit(i)                    # exit program
  289.  
  290. Terminates the program with exit status i.
  291.  
  292. Default:
  293. i    normal exit (system dependent)
  294. -
  295. exp(r1) : r2                # compute exponential
  296.  
  297. Produces e raised to the power r1.
  298. -
  299. find(s1,s2,i1,i2) : i3,i4,...,in    # find string
  300.  
  301. Generates the sequence of integer positions in s2 at which s1 occurs as
  302. a substring in s2[i1:i2], but fails if there is no such position.
  303.  
  304. Defaults:
  305. s2    &subject
  306. i1    &pos if s2 defaulted, otherwise 1
  307. i2    0 
  308. -
  309. flush(f) : n                # flush I/O buffer
  310.  
  311. Flushes the input/output buffers for f.
  312. -
  313. function() : s1,s2,...,sn        # generate function names
  314.  
  315. Generates the names of the Icon (built-in) functions.
  316. -
  317. get(L) : x                # get value from list
  318.  
  319. Produces the leftmost element of L and removes it from L, but fails if
  320. L is empty; synonym for pop(L).
  321. -
  322. getenv(s1) : s2                # get value of environment variable
  323.  
  324. Produces the value of environment variable s1, but fails if the
  325. variable is not set or environment variables are not supported.
  326. -
  327. iand(i1,i2) : i3            # compute bit-wise "and"
  328.  
  329. Produces the bitwise "and" of i1 and i2.
  330. -
  331. icom(i1) : i2                # compute bit-wise complement
  332.  
  333. Produces the bitwise complement (1's complement) of i1.
  334. -
  335. image(x) : s                # produce string image
  336.  
  337. Produces a string image of x.
  338. -
  339. insert(X,x1,x2) : X            # insert element
  340.  
  341. If X is a table, inserts the key x1 with value x2 into X.  If X is a
  342. set, inserts x1 into X.  Produces X.
  343.  
  344. Default:
  345. x2    &null
  346. -
  347. integer(x) : i                # convert to integer
  348.  
  349. Produces the integer resulting from converting x, but fails if the
  350. conversion is not possible.
  351. -
  352. ior(i1,i2) : i3                # compute bit-wise inclusive "or"
  353.  
  354. Produces the bitwise inclusive "or" of i1 and i2
  355. -
  356. ishift(i1,i2) : i3            # shift bits
  357.  
  358. Produces the result of shifting the bits in i1 by i2 positions.
  359. Positive values of i2 shift to the left, negative to the right.
  360. Vacated bit positions are zero-filled.
  361. -
  362. ixor(i1,i2) : i3            # compute bit-wise exclusive "or"
  363.  
  364. Produces the bitwise exclusive "or" of i1 and i2.
  365. -
  366. key(T) : x1,x2,...,xn            # generate keys from table
  367.  
  368. Generates the keys in table T.
  369. -
  370. left(s1,i,s2) : s3            # position string at left
  371.  
  372. Produces a string of size i in which s1 is positioned at the left, with
  373. s2 used for padding on the right as necessary.
  374.  
  375. Defaults:
  376. i    1
  377. s2    " " (blank)
  378. -
  379. list(i,x) : L                # create list
  380.  
  381. Produces a list of size i in which each value is x.
  382.  
  383. Defaults:
  384. i    0
  385. x    &null
  386. -
  387. log(r1,r2) : r3                # compute logarithm
  388.  
  389. Produces the logarithm of r1 to the base r2.
  390.  
  391. Default:
  392. r2    e
  393. -
  394. many(c,s,i1,i2) : i3            # locate many characters
  395.  
  396. Succeeds and produces the position in s after the longest initial sequence
  397. of characters in c in s[i1:i2].  It fails if s[i1] is not in c.
  398.  
  399. Defaults:
  400. s    &subject
  401. i1    &pos if s defaulted, otherwise 1
  402. i2    0 
  403. -
  404. map(s1,s2,s3) : s4            # map characters
  405.  
  406. Produces a string of size *s1 obtained by mapping characters of s1 that
  407. occur in s2 into corresponding characters in s3.
  408.  
  409. Defaults:
  410. s2    string(&ucase)
  411. s3    string(&lcase)
  412. -
  413. match(s1,s2,i1,i2) : i3            # match initial string
  414.  
  415. Produces i1 + *s1 if s1 == s2[i1+:*s1], but fails otherwise.
  416.  
  417. Defaults:
  418. s2    &subject
  419. i1    &pos if s2 defaulted, otherwise 1
  420. i2    0 
  421. -
  422. member(X,x) : x                # test for membership
  423.  
  424. If X is a set, succeeds if x is a member of X, but fails otherwise.  If
  425. X is a table, succeeds if x is a key of an element in X, but fails
  426. otherwise.  Produces x if it succeeds.
  427. -
  428. mmout(x) : n                # write text to allocation history
  429.  
  430. Writes s to the allocation history file.  s is given no
  431. interpretation.
  432. -
  433. mmpause(s) : n                # write pause to allocation history
  434.  
  435. Writes s to the allocation history file as a pause point with
  436. identification s.
  437.  
  438. Default:
  439. s    "programmed pause"
  440. -
  441. mmshow(x,s) : n                # redraw in allocation history
  442.  
  443. Specifies redrawing of x in the allocation history file.  The color is
  444. defined by s as follows:
  445.  
  446.     "b"    black
  447.     "g"    gray
  448.     "w"    white
  449.     "h"    highlight; blinking black and white if possible
  450.     "r"    normal color
  451.  
  452. If x is not in an allocated region, has no effect.
  453.  
  454. Default:
  455. s    "r"
  456. -
  457. move(i) : s                # move scanning position
  458.  
  459. Produces &subject[&pos:&pos + i] and assigns i + &pos to &pos, but
  460. fails if i is out of range; reverses assignment to &pos if resumed.
  461. -
  462. name(x) : s                # produce name
  463.  
  464. Produces the name of the variable x.  If x is an identifier or a
  465. keyword that is a variable, the name of the identifier or keyword is
  466. produced.  If x is a record field reference, the record name and field
  467. name are produced with a separating period.  If x is a string, the name
  468. of the string and the subscript range are shown.  If x is a subscripted
  469. list or table, the type name followed by the subscripting expression is
  470. produced.
  471. -
  472. numeric(x) : N                # convert to numeric
  473.  
  474. Produces an integer or real number resulting from converting x, but
  475. fails if the conversion is not possible.
  476. -
  477. open(s1,s2) : f                # open file
  478.  
  479. Produces a file resulting from opening s1 according to options in s2,
  480. but fails if the file cannot be opened.  The options are:
  481.  
  482.     "r"    open for reading
  483.     "w"    open for writing
  484.     "a"    open for writing in append mode
  485.     "b"    open for reading and writing
  486.     "c"    create
  487.     "t"    translate line termination sequences to linefeeds
  488.     "u"    do not translate line termination sequences to linefeeds
  489.     "p"    pipe to/from a command -- UNIX
  490.  
  491. The default mode is to translate line termination sequences to
  492. linefeeds on input and conversely on output.  The untranslated mode
  493. should be used when reading and writing binary files.
  494.  
  495. Default:
  496. s2    "rt"
  497. -
  498. ord(s) : i                # produce ordinal
  499.  
  500. Produces an integer (ordinal) between 0 and 255 that is the internal
  501. representation of the single character in s.
  502. -
  503. pop(L) : x                # pop from list
  504.  
  505. Produces the leftmost element of L and removes it from L, but fails if
  506. L is empty; synonym for get(L).
  507. -
  508. pos(i1) : i2                # test scanning position
  509.  
  510. Produces &pos if &pos = i1, but fails otherwise.
  511. -
  512. proc(x,i) : p                # convert to procedure
  513.  
  514. Produces a procedure corresponding to the value of x, but fails if x
  515. does not correspond to a procedure.  If x is the string name of an
  516. operator, i specifies the number of arguments: 1 for unary (prefix), 2
  517. for binary (infix), and 3 for ternary.
  518.  
  519. Default:
  520. i    1
  521. -
  522. pull(L) : x                # pull from list
  523.  
  524. Produces the rightmost element of L and removes it from L, but fails if
  525. L is empty.
  526. -
  527. push(L,x) : L                # push onto list
  528.  
  529. Adds x to the left end of L and produces L.
  530. -
  531. put(L,x) : L                # put onto list
  532.  
  533. Adds x to the right end of L and produces L.
  534. -
  535. read(f) : s                # read line
  536.  
  537. Produces the next line from f, but fails on end of file.
  538.  
  539. Default:
  540. f    &input
  541. -
  542. reads(f,i) : s                # read string
  543.  
  544. Produces a string consisting of the next i characters from f, or the
  545. remaining characters of f if fewer remain, but fails on an end of
  546. file.  In reads(), unlike read(), line termination sequences have no
  547. special significance.  reads() should be used for reading binary data.
  548.  
  549. Defaults:
  550. f    &input
  551. i    1
  552. -
  553. real(x) : r                # convert to real
  554.  
  555. Produces a real number resulting from type conversion of x, but fails
  556. if the conversion is not possible.
  557. -
  558. remove(s) : n                # remove file
  559.  
  560. Removes (deletes) the file named s, but fails if s cannot be removed.
  561. -
  562. rename(s1,s2) : n            # rename file
  563.  
  564. Renames the file named s1 to be s2, but fails if the renaming cannot be
  565. done.
  566. -
  567. repl(s1,i) : s2                # replicate string
  568.  
  569. Produces a string consisting of i concatenations of s1.
  570. -
  571. reverse(s1) : s2            # reverse string
  572.  
  573. Produces a string consisting of the reversal of s.
  574. -
  575. right(s1,i,s2) : s3            # position string at right
  576.  
  577. Produces a string of size i in which s1 is positioned at the right, with
  578. s2 used for padding on the left as necessary.
  579.  
  580. Defaults:
  581. i    1
  582. s2    " " (blank)
  583. -
  584. rtod(r1) : r2                # convert radians to degrees
  585.  
  586. Produces the degree equivalent of r1 given in radians.
  587. -
  588. runerr(i,x)                # terminate with run-time error
  589.  
  590. Terminates program execution with error i and offending value x.
  591.  
  592. Default:
  593. x    no offending value
  594. -
  595. save(s) : i                # save executable image
  596.  
  597. Saves an executable image of the current running program in the file
  598. named s and produces the size of the file, but fails if the file cannot
  599. be created.
  600. -
  601. seek(f,i) : f                # seek to position in file
  602.  
  603. Seeks to position i in f, but fails if the seek cannot be performed.
  604. The first byte in the file is at position 1.  seek(f,0) seeks to the
  605. end of file f.
  606. -
  607. seq(i1,i2) : i3,i4,...            # generate sequence of integers
  608.  
  609. Generates an endless sequence of integers starting at i1 with
  610. increments of i2.
  611.  
  612. Defaults:
  613. i1    1
  614. i2    1
  615. -
  616. set(L) : S                # create set
  617.  
  618. Produces a set whose members are the distinct values in the list L.
  619.  
  620. Default:
  621. L    []
  622. -
  623. sin(r1) : r2                # compute sine
  624.  
  625. Produces the sine of r1 given in radians.
  626. -
  627. sort(X,i) : L                # sort structure
  628.  
  629. Produces a list containing values from X.  If X is a list or a set,
  630. sort(X,i) produces the values of X in sorted order.  If X is a table,
  631. sort(X,i)produces a list obtained by sorting the elements of X,
  632. depending on the value of i.  For Produces a list according to i:
  633.  
  634. i = (1 | 2)     Produces a list of two-element lists of key/value pairs
  635.         from X; ordered by keys for i = 1, by values for i =
  636.         2.
  637. i = (3 | 4)    Produces a list of size 2 * *X with each consecutive
  638.         pair of elements consisting of a key and a value from
  639.         X; ordered by keys for i = 3, by values for i = 4.
  640.  
  641. Default:
  642. i    1
  643. -
  644. sortf(X,i) : L                # sort list or set by field
  645.  
  646. Produces a sorted list of the values in X.  Sorting is primarily by
  647. type and in most respects is the same as with sort(X,i).  However,
  648. among lists and among records, two structures are ordered by comparing
  649. their ith fields.  i can be negative but not zero.  Two structures
  650. having the equal ith fields are ordered as they would be in regular
  651. sorting, but structures lacking an ith field appear before structures
  652. having them.
  653.  
  654. Default:
  655. i    1
  656. -
  657. sqrt(r1) : r2                # compute square root
  658.  
  659. Produces the square root of r1.
  660. -
  661. stop(x1,x2,...,xn)            # stop execution
  662.  
  663. Terminates program execution with an error status after writing strings
  664. x1,x2,...,xn.  If xi is a file, subsequent output is to xi.  Initial
  665. output is to standard error output.
  666.  
  667. Default:
  668. xi    "" (empty string)
  669. -
  670. string(x) : s                # convert to string
  671.  
  672. Produces a string resulting from converting x, but fails if the
  673. conversion is not possible.
  674. -
  675. system(s) : i                # call system function
  676.  
  677. Calls the C library function "system" to execute s and produces the
  678. resulting integer exit status.
  679. -
  680. tab(i) : s                # set scanning position
  681.  
  682. Produces &subject[&pos:i] and assigns i to &pos, but fails if i is out
  683. of range.  It reverses assignment to &pos if resumed.
  684. -
  685. table(x) : T                # create table
  686.  
  687. Produces a table with a default value x.
  688.  
  689. Default:
  690. x    &null
  691. -
  692. tan(r1) : r2                # compute tangent
  693.  
  694. Produces the tangent of r1 given in radians.
  695. -
  696. trim(s1,c) : s2                # trim string
  697.  
  698. Produces a string consisting of the characters of s1 up to the trailing
  699. characters contained in c.
  700.  
  701. Default:
  702. c    ' ' (blank)
  703. -
  704. type(x) : s                # produce type name
  705.  
  706. Produces a string corresponding to the type of x.
  707. -
  708. upto(c,s,i1,i2) : i3,i4,...,in        # locate characters
  709.  
  710. Generates the sequence of integer positions in s preceding a character
  711. of c in s[i1:i2].  It fails if there is no such position.
  712.  
  713. Defaults:
  714. s    &subject
  715. i1    &pos if s defaulted, otherwise 1
  716. i2    0 
  717. -
  718. variable(s) : x                # produce variable
  719.  
  720. Produces the variable for the identifier or keyword named s, but fails
  721. if there is no such variable.  Local identifiers override global
  722. identifiers.
  723. -
  724. where(f) : i                # produce position in file
  725.  
  726. Produces the current byte position in f.  The first byte in the file is
  727. at position 1.
  728. -
  729. write(x1,x2,...,xn) : xn        # write line
  730.  
  731. Writes strings x1,x2,...,xn with a line termination sequence added at
  732. the end.  If xi is a file, subsequent output is to xi.  Initial output
  733. is to standard output.
  734.  
  735. Default:
  736. xi    "" (empty string)
  737. -
  738. writes(x1,x2,...,xn)            # write string
  739.  
  740. Writes strings x1,x2,...,xn without a line termination sequence added
  741. at the end.  If xi is a file, subsequent output is to xi.  Initial
  742. output is to standard output.
  743.  
  744. Default:
  745. xi    "" (empty string)
  746. -
  747. icont -- Icon translator and linker
  748.  
  749. icont [option...] file...
  750.     -c                # translate only (no link)
  751.     -o file            # name icode file "file"
  752.     -s                # suppress progress messages
  753.     -t                # give &trace initial value of -1
  754.     -u                # issue warnings for undeclared identifiers
  755.  
  756. See also:
  757.     ihelp iconx
  758. -
  759. iconx -- Icon interpreter
  760.  
  761. The Icon interpreter is normally invoked automatically when the name of
  762. an Icon program is entered as a command, but it can be invoked
  763. explicitly, too.
  764.  
  765. iconx icode_file_name [arguments for Icon program.]
  766.  
  767.  
  768.  
  769.     Shell environment variables recognized by iconx
  770.     ===============================================
  771.     Name    Default     Description
  772.     --------    -------     -----------------------
  773.     TRACE    0        Initial value for &trace.
  774.     NOERRBUF    undefined   If set, &errout is not buffered.
  775.     STRSIZE    65000        Initial size (bytes) of string region
  776.                 (strings).
  777.     BLOCKSIZE    65000        Initial size (bytes) of block region
  778.                 (most objects).
  779.     COEXPSIZE    2000        Size (long words) of co-expression blocks.
  780.     MSTKSIZE    10000        Size (long words) of main interpreter stack.
  781.     STATSIZE    20480        Initial size (bytes) of static region
  782.                 (co-expression blocks).
  783.     STATINCR    1/4 of        Increment used to expand static region.
  784.         STATSIZE
  785.  
  786.  
  787. See also:
  788.     ihelp icont
  789. -
  790. Expressions shown in order of decreasing precedence.  Items in groups
  791. (as separated by empty lines) have equal precedence.
  792.  
  793. High Precedence Expressions
  794.  
  795.     (expr)            # grouping
  796.     {expr1;expr2;...}        # compound
  797.     x(expr1,expr2,...)        # invocation
  798.     x{expr1,expr2,...}        # "
  799.     [expr1,expr2,...]        # list
  800.     expr.F            # field reference
  801.     expr1[expr2]        # subscript
  802.     expr1[expr2:expr3]        # section
  803.     expr1[expr2+:expr3]        # "
  804.     expr1[expr2-:expr3]        # "
  805.  
  806. Prefix Expressions
  807.  
  808.     not    expr            # success/failure reversal
  809.     | expr            # repeated alternation
  810.     ! expr            # element generation
  811.     * expr            # size
  812.     + expr            # numeric value
  813.     - expr            # negative
  814.     . expr            # value (dereference)
  815.     / expr            # null
  816.     \ expr            # non-null
  817.     = expr            # match and tab
  818.     ? expr            # random value
  819.     ~ expr            # cset complement
  820.     @ expr            # activation
  821.     ^ expr            # refresh
  822.  
  823. Infix Expressions
  824.  
  825.     expr1 \ expr2        # limitation
  826.     expr1 @ expr2        # transmission
  827.     expr1 ! expr2        # invocation
  828.  
  829.     expr1 ^ expr2        # power
  830.  
  831.     expr1 * expr2        # product
  832.     expr1 / expr2        # quotient
  833.     expr1 % expr2        # remainder
  834.     expr1 ** expr2        # intersection
  835.  
  836.     expr1 + expr2        # sum
  837.     expr1 - expr2        # numeric difference
  838.  
  839.     expr1 ++ expr2        # union
  840.     expr1 -- expr2        # cset or set difference
  841.  
  842.     expr1 || expr2        # string concatenation
  843.     expr1 ||| expr2        # list concatenation
  844.  
  845.     expr1 < expr2        # numeric comparison
  846.     expr1 <= expr2        # "
  847.     expr1 = expr2        # "
  848.     expr1 >= expr2        # "
  849.     expr1 > expr2        # "
  850.     expr1 ~= expr2        # "
  851.     expr1 << expr2        # string comparison
  852.     expr1 <<= expr2        # "
  853.     expr1 == expr2        # "
  854.     expr1 >>= expr2        # "
  855.     expr1 >> expr2        # "
  856.     expr1 ~== expr2        # "
  857.     expr1 === expr2        # value comparison
  858.     expr1 ~=== expr2        # "
  859.  
  860.     expr1 | expr2        # alternation
  861.  
  862.     expr1 to expr2 by expr3    # integer generation
  863.  
  864.     expr1 := expr2        # assignment
  865.     expr1 <- expr2        # reversible assignment
  866.     expr1 :=: expr2        # exchange
  867.     expr1 <-> expr2        # reversible exchange
  868.     expr1 op:= expr2        # (augmented assignments)
  869.  
  870.     expr1 ? expr2        # string scanning
  871.  
  872.     expr1 & expr2        # conjunction
  873.  
  874. Low Precedence Expressions
  875.  
  876.     break [expr]               # break from loop
  877.     case expr0 of {            # case selection
  878.        expr1:expr2
  879.        ...
  880.        [default:exprn]
  881.        }
  882.     create expr                # co-expression creation
  883.     every expr1 [do expr2]        # iterate over generated values
  884.     fail                # failure of procedure
  885.     if expr1 then exp2 [else exp3]  # if-then-else
  886.     next                # go to top of loop
  887.     repeat expr                # loop
  888.     return expr                # return from procedure
  889.     suspend expr1 [do expr2]        # suspension of procedure
  890.     until expr1 [do expr2]        # until-loop
  891.     while expr1 [do expr2]        # while-loop
  892. -
  893. Functions and datatypes of arguments and produced values:
  894.  
  895. abs(N) : N                # compute absolute value
  896. acos(r1) : r2                # compute arc cosine
  897. any(c,s,i1,i2) : i3            # locate initial character
  898. args(p) : i                # get number of procedure arguments
  899. bal(c1,c2,c3,s,i1,i2) : i3,i4,...,in    # locate balanced characters
  900. callout(x,x1,x2,...,xn) : xm        # call external function
  901. center(s1,i,s2) : s3            # position string at center
  902. char(i) : s                # produce character
  903. chdir(s) : n                # change directory
  904. close(f) : f                # close file
  905. collect(i1,i2) : n            # perform garbage collection
  906. copy(x1) : x2                # copy value
  907. cos(r1) : r2                # compute cosine
  908. cset(x)                    # convert to cset
  909. delay(i) : n                # delay execution
  910. delete(X,x) : X                # delete element
  911. detab(s1,i1,i2,...,in) : s2        # remove tabs
  912. display(i,f) : n            # display variables
  913. dtor(r1) : r2                # convert degrees to radians
  914. entab(s1,i1,i2,...,in) : s2        # insert tabs
  915. errorclear() : n            # clear error indication
  916. exit(i)                    # exit program
  917. exp(r1) : r2                # compute exponential
  918. find(s1,s2,i1,i2) : i3,i4,...,in    # find string
  919. flush(f) : n                # flush I/O buffer
  920. function() : s1,s2,...,sn        # generate function names
  921. get(L) : x                # get value from list
  922. getenv(s1) : s2                # get value of environment variable
  923. iand(i1,i2) : i3            # compute bit-wise "and"
  924. icom(i1) : i2                # compute bit-wise complement
  925. image(x) : s                # produce string image
  926. insert(X,x1,x2) : X            # insert element
  927. integer(x) : i                # convert to integer
  928. ior(i1,i2) : i3                # compute bit-wise inclusive "or"
  929. ishift(i1,i2) : i3            # shift bits
  930. ixor(i1,i2) : i3            # compute bit-wise exclusive "or"
  931. key(T) : x1,x2,...,xn            # generate keys from table
  932. left(s1,i,s2) : s3            # position string at left
  933. list(i,x) : L                # create list
  934. log(r1,r2) : r3                # compute logarithm
  935. many(c,s,i1,i2) : i3            # locate many characters
  936. map(s1,s2,s3) : s4            # map characters
  937. match(s1,s2,i1,i2) : i3            # match initial string
  938. member(X,x) : x                # test for membership
  939. mmout(x) : n                # write text to allocation history
  940. mmpause(s) : n                # write pause to allocation history
  941. mmshow(x,s) : n                # redraw in allocation history
  942. move(i) : s                # move scanning position
  943. name(x) : s                # produce name
  944. numeric(x) : N                # convert to numeric
  945. open(s1,s2) : f                # open file
  946. ord(s) : i                # produce ordinal
  947. pop(L) : x                # pop from list
  948. pos(i1) : i2                # test scanning position
  949. proc(x,i) : p                # convert to procedure
  950. pull(L) : x                # pull from list
  951. push(L,x) : L                # push onto list
  952. put(L,x) : L                # put onto list
  953. read(f) : s                # read line
  954. reads(f,i) : s                # read string
  955. real(x) : r                # convert to real
  956. remove(s) : n                # remove file
  957. rename(s1,s2) : n            # rename file
  958. repl(s1,i) : s2                # replicate string
  959. reverse(s1) : s2            # reverse string
  960. right(s1,i,s2) : s3            # position string at right
  961. rtod(r1) : r2                # convert radians to degrees
  962. runerr(i,x)                # terminate with run-time error
  963. save(s) : i                # save executable image
  964. seek(f,i) : f                # seek to position in file
  965. seq(i1,i2) : i3,i4,...            # generate sequence of integers
  966. set(L) : S                # create set
  967. sin(r1) : r2                # compute sine
  968. sort(X,i) : L                # sort structure
  969. sortf(X,i) : L                # sort list or set by field
  970. sqrt(r1) : r2                # compute square root
  971. stop(x1,x2,...,xn)            # stop execution
  972. string(x) : s                # convert to string
  973. system(s) : i                # call system function
  974. tab(i) : s                # set scanning position
  975. table(x) : T                # create table
  976. tan(r1) : r2                # compute tangent
  977. trim(s1,c) : s2                # trim string
  978. type(x) : s                # produce type name
  979. upto(c,s,i1,i2) : i3,i4,...,in        # locate characters
  980. variable(s) : x                # produce variable
  981. where(f) : i                # produce position in file
  982. write(x1,x2,...,xn) : xn        # write line
  983. writes(x1,x2,...,xn)            # write string
  984. -
  985. Operations and required datatypes
  986.  
  987. prefix operations
  988.  
  989.     +N : N            # compute positive
  990.     -N : N            # compute negative
  991.     ~c1 : c2            # compute cset complement
  992.     =s1 : s2            # match string in scanning
  993.     @C : x            # activate co-expression
  994.     ^C1 : C2            # create refreshed co-expression
  995.     *x : i            # compute size
  996.     ?x1 : x2            # generate random value
  997.     !x : x1,x2,...,xn        # generate values
  998.     /x : x            # check for null value
  999.     \x : x            # check for non-null value
  1000.     .x : x            # dereference variable
  1001.  
  1002. infix operations
  1003.  
  1004.     N1 + N2 : N3        # compute sum
  1005.     N1 - N2 : N3        # compute difference
  1006.     N1 * N2 : N3        # compute product
  1007.     N1 / N2 : N3        # compute quotient
  1008.     N1 % N2 : N3        # compute remainder
  1009.     N1 ^ N2 : N3        # compute exponential
  1010.     x1 ++ x2 : x3        # compute cset or set union
  1011.     x1 -- x2 : x3        # compute cset or set difference
  1012.     x1 ** x2 : x3        # compute cset or set intersection
  1013.     s1 || s2 : s3        # concatenate strings
  1014.     L1 ||| L2 : L3        # concatenate lists
  1015.     R.F : x            # get field of record
  1016.     x1 @ C : x2            # transmission value to co-expression
  1017.     x1 & x2 : x2        # evaluate in conjunction
  1018.     N1 < N2 : N2        # compare numerically
  1019.     N1 <= N2 : N2        # "
  1020.     N1 = N2 : N2        # "
  1021.     N1 >= N2 : N2        # "
  1022.     N1 > N2 : N2        # "
  1023.     N1 ~= N2 : N2        # "
  1024.     s1 << s2 : s2        # compare lexically
  1025.     s1 <<= s2 : s2        # "
  1026.     s1 == s2 : s2        # "
  1027.     s1 >>= s2 : s2        # "
  1028.     s1 >> s2 : s2        # "
  1029.     s1 ~== s2 : s2        # "
  1030.     x1 === x2 : x2        # compare values
  1031.     x1 ~=== x2 : x2        # "
  1032.     x1 := x2 : x1        # assign value
  1033.     x1 op:= x2 : x1        # augmented assignment
  1034.     x1 :=: x2 : x1        # exchange values
  1035.     x1 <- x2 : x1        # assign value reversibly
  1036.     x1 <-> x2 : x1        # exchange values reversibly
  1037. -
  1038. Keywords
  1039.  
  1040.     &allocated : i1,i2,i3,i4    # accumulated bytes allocated
  1041.                 # (total,static,string,block)
  1042.     &ascii : c            # cset of ascii characters
  1043.     &clock : s            # current time of day
  1044.     &collections : i1,i2,i3,i4    # collection count
  1045.                 # (total,static,string,block)
  1046.     &cset : c            # cset of all characters
  1047.     ¤t : C        # current co-expression
  1048.     &date : s            # current date
  1049.     &dateline : s        # current date and time
  1050.     &digits : c            # cset of digits 0-9
  1051.     &e : r            # base of natural logarithms, 2.71828...
  1052.     &error : i            # run-time error conversion control
  1053.     &errornumber : i        # run-time error number
  1054.     &errortext : s        # run-time error message text
  1055.     &errorvalue    : x        # run-time error offending value
  1056.     &errout : f            # standard error output file
  1057.     &fail            # fails
  1058.     &features : s1,s2,...,sn    # implementation features
  1059.     &file : s            # current source code file name
  1060.     &host : s            # string identifying host computer
  1061.     &input : f            # standard input file
  1062.     &lcase : c            # cset of lower case letters a-z
  1063.     &letters : c        # cset of all letters A-Za-z
  1064.     &level : i            # level of current procedure call
  1065.     &line : i            # current source code line number
  1066.     &main : C            # main co-expression
  1067.     &null : n            # the null value
  1068.     &output : f            # standard output file
  1069.     &phi : r            # the golden ratio, 1.61803...
  1070.     &pi : r            # the value of pi, 3.14159...
  1071.     &pos : i            # string scanning position
  1072.     &progname : s        # file name of the executing program
  1073.     &random : i            # random number seed
  1074.     ®ions : i1,i2,i3        # current region size
  1075.                 # (static,string,block)
  1076.     &source : C            # activator of current co-expression
  1077.     &storage : i1,i2,i3        # current bytes allocated
  1078.                 # (static,string,block)
  1079.     &subject : s        # string scanning subject
  1080.     &time : i            # current run time in milliseconds
  1081.     &trace : i            # procedure tracing control
  1082.     &ucase : c            # cset of upper case letters A-Z
  1083.     &version : s        # version of Icon
  1084. -
  1085. Datatypes
  1086.  
  1087.     null (n)     string (s)   co-expression (C)   table (T)
  1088.     integer (i)     cset (c)     procedure (p)       set (S)
  1089.     real (r)     file (f)     list (L)            <record types> (R)
  1090.  
  1091.     (see also "Abbreviations")
  1092. -
  1093. Reserved words
  1094.  
  1095.     break    do        global    next        repeat    to
  1096.     by        else        if        not        return    until
  1097.     case    end        initial    of        static    while
  1098.     create    every        link    procedure   suspend
  1099.     default    fail        local    record        then
  1100. -
  1101. Escapes in string and cset constants
  1102.  
  1103.     \b        backspace            \v    vertical tab
  1104.     \d        delete(rubout)        \'    single quote
  1105.     \e        escape (altmode)        \"    double quote
  1106.     \f        formfeed            \\    backslash
  1107.     \l        linefeed (newline)        \ddd    octal code
  1108.     \n        newline (linefeed)        \xdd    hexadecimal code
  1109.     \r        carriage return        \^c    control code
  1110.     \t        horizontal tab
  1111. -
  1112. Abbreviations used in Icon help files (and other Icon literature)
  1113.  
  1114.     c    cset        C    co-expression
  1115.     f    file        L    list
  1116.     i    integer        N    numeric (i or r)
  1117.     n    null        R    record (any record type)
  1118.     p    procedure    S    set
  1119.     r    real        T    table
  1120.     s    string        X    any structure type (L, R, S, or T)
  1121.     x    any type    F    field of record
  1122. -
  1123. About the Icon Programming Language Help File
  1124.  
  1125. Information used in this help file was obtained from the following
  1126. sources:
  1127.  
  1128. Griswold, Ralph E. and Madge T. Griswold.  "The Icon Programming
  1129. Language, Second Edition", Prentice-Hall, Inc., Englewood Cliffs, New
  1130. Jersey.  1990.
  1131.  
  1132. Griswold, Ralph E.  ICONT(1), manual page for "UNIX Programmer's
  1133. Manual", Department of Computer Science, The University of Arizona.
  1134. 1988.
  1135.  
  1136. Griswold, Ralph  E., Clinton L. Jeffery, Gregg M. Townsend, and
  1137. Kenneth Walker.  "Version 8.6 of the Icon Programming Language",
  1138. IPD188, Department of Computer Science, The University of Arizona.
  1139. 1992.
  1140.  
  1141. Further information on the Icon Programming Language can be obtained
  1142. from:
  1143.  
  1144.     Icon Project
  1145.     Department of Computer Science
  1146.     Gould-Simpson Building
  1147.     The University of Arizona
  1148.     Tucson, Arizona  85721
  1149.     U.S.A.
  1150.     (602) 621-2018
  1151.     icon-project@cs.arizona.edu            (Internet)
  1152.     ...{uunet,allegra,noao}!arizona!icon-project    (uucpnet)
  1153.  
  1154. April 2, 1992.
  1155.